package com.csd.activity;

import android.app.ActionBar;
import android.app.Activity;
import android.app.ActionBar.LayoutParams;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class EmployeeActivity extends Activity implements OnClickListener{

	private LinearLayout ll_phone,ll_info;
	private Button bt_credentials,bt_update,bt_cancle,bt_sure;
	private ActionBar actionBar;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_employee);
		initView();
		initActionBar();
	}
	
	private void initActionBar() {
		// TODO Auto-generated method stub
		actionBar = getActionBar();
		actionBar.setDisplayHomeAsUpEnabled(false);
		actionBar.setDisplayShowHomeEnabled(false);
		actionBar.setDisplayShowTitleEnabled(false);
		actionBar.setDisplayShowCustomEnabled(true);

		LayoutInflater inflator = (LayoutInflater) getSystemService(this.LAYOUT_INFLATER_SERVICE);

		View v = inflator.inflate(R.layout.actionbar_main, null);
		TextView title = (TextView) v.findViewById(R.id.title);
		title.setText("员工个人信息");
		ImageView img = (ImageView) v.findViewById(R.id.logo);
		img.setImageDrawable(getResources().getDrawable(R.drawable.u86));
		img.setOnClickListener(this);
		ActionBar.LayoutParams layout = new ActionBar.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
		actionBar.setCustomView(v, layout);

	}

	private void initView() {
		// TODO Auto-generated method stub
		ll_phone = (LinearLayout) findViewById(R.id.ll_phone);
		ll_info = (LinearLayout) findViewById(R.id.ll_info);
		bt_credentials = (Button) findViewById(R.id.bt_credentials);
		bt_credentials.setOnClickListener(this);
		bt_update = (Button) findViewById(R.id.update);
		bt_update.setOnClickListener(this);
		bt_cancle = (Button) findViewById(R.id.bt_cancle);
		bt_sure = (Button) findViewById(R.id.bt_sure);
		bt_cancle.setOnClickListener(this);
		bt_sure.setOnClickListener(this);
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.bt_credentials:
			CsdApplication.showContent(ll_phone, this);
			break;
		case R.id.update:
			CsdApplication.showContent(ll_info, this);
			break;
		case R.id.bt_cancle:
			ll_info.setVisibility(View.GONE);
			break;
		case R.id.bt_sure:
			ll_info.setVisibility(View.GONE);
			break;
		case R.id.logo:
			finish();
			break;
		default:
			break;
		}
	}
	
}
